Highcharts.setOptions({
    lang: {
        numericSymbols: null
    }
});



function createCharts(id,data){
    var chartInfo=getChartParm(data);
    var chartConfig={
        chart: {
            renderTo:id,
            type: chartInfo.chartParm.chartType
        },
        title:{text:null},
        subtitle: {
            text:chartInfo.chartParm.subTitle||"",
            align:'center'
        },
        colors:chartInfo.chartParm.colors||null,
        
        xAxis: {

            categories:chartInfo.datas.xAxis
        },
        yAxis: {
           title:null 
        },
        credits: {
            enabled: false
        },
        
        series: chartInfo.datas.yAxis
    };
    var Config=$.extend({},chartConfig,chartInfo.chartParm.conf);
    console.log(Config);
    return new Highcharts.Chart(Config);
}

function getChartParm(data){
    var chartInfo={chartParm:{},datas:data};

     switch(data.title){
        case "会员服务费总额":
            chartInfo.chartParm.chartType="areaspline";
            chartInfo.chartParm.subTitle="(美元)";
            chartInfo.chartParm.colors=["#febe5f"];
            chartInfo.chartParm.tooltiptext="获取服务费";
            chartInfo.chartParm.conf={
                plotOptions: {
                    areaspline: {
                        fillOpacity: 0.1
                    }
                },
                legend:{enabled:false}
            };
            break;
        case "总交易量":
            chartInfo.chartParm.chartType="areaspline";
            chartInfo.chartParm.subTitle="(手)";
            chartInfo.chartParm.colors=["#61a8fd","#ffc265"];
            chartInfo.chartParm.tooltiptext="客户总交易量";
            chartInfo.chartParm.conf={
                plotOptions: {
                    areaspline: {
                        fillOpacity: 0
                    }
                }
            };
            break;
        case "总客户数":
            chartInfo.chartParm.chartType="areaspline";
            chartInfo.chartParm.subTitle="(人)";
            chartInfo.chartParm.colors=["#62a9fe","#59d39b"];
            chartInfo.chartParm.conf={
                plotOptions: {
                    areaspline: {
                        fillOpacity: 0.1
                    }
                }
            };
            break;
        case "客户交易量Top20":
            chartInfo.chartParm.chartType="column";
            chartInfo.chartParm.subTitle="(手)";
            chartInfo.chartParm.colors=["rgba(98,169,254,0.35)","rgba(255,191,94,0.35)"];
            chartInfo.chartParm.conf={
                plotOptions: {
                    column: {
                        pointPadding:0
                    }
                }
            };
            $.extend(chartInfo.datas.yAxis[0],{borderColor: '#62a9fe',states:{hover:{color:'#62a9fe'}}});
            $.extend(chartInfo.datas.yAxis[1],{borderColor:'#ffbf5e',states:{hover:{color:'#ffbf5e'}}});
            break;
        case "每月/日交易量":
            chartInfo.chartParm.chartType="column";
            chartInfo.chartParm.subTitle="(手)";
            chartInfo.chartParm.colors=["rgba(98,169,254,0.35)","rgba(255,191,94,0.35)"];
            chartInfo.chartParm.conf={
                plotOptions: {
                    column: {
                        pointPadding:0
                    }
                }
            };
            $.extend(chartInfo.datas.yAxis[0],{borderColor: '#62a9fe',states:{hover:{color:'#62a9fe'}}});
            $.extend(chartInfo.datas.yAxis[1],{borderColor:'#ffbf5e',states:{hover:{color:'#ffbf5e'}}});
            break;
        case "每月/日服务费":
            chartInfo.chartParm.chartType="column";
            chartInfo.chartParm.subTitle="(美元)";
            chartInfo.chartParm.colors=["rgba(98,169,254,0.35)"];
            chartInfo.chartParm.conf={
                legend:{enabled:false}
            };
            $.extend(chartInfo.datas.yAxis[0],{borderColor: '#62a9fe',states:{hover:{color:'#62a9fe'}}});
            break;
        case "每月/日客服数":
            chartInfo.chartParm.chartType="column";
            chartInfo.chartParm.subTitle="<b>成绩等级分布<b>";
            chartInfo.chartParm.colors=["rgba(98,169,254,0.35)"];
            chartInfo.chartParm.conf={
                legend:{enabled:false}
            };
            $.extend(chartInfo.datas.yAxis[0],{borderColor: '#62a9fe',states:{hover:{color:'#62a9fe'}}});
            break;
        default:
            chartInfo={};
     }
     return chartInfo;
}